﻿using Bll;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Myproject.Menu
{
    public partial class MenuEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            string menuID = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(menuID))
            {
                menu_menuEdit_id.Value = menuID;
                MenuModel model = new MenuBll().GetModel(Int32.Parse(menuID));
                menu_menuEdit_pid.Value = model.Pid.ToString();
                menu_menuEdit_tid.Value = model.MenuTypeID.ToString();
                if (model.Pid != 0)
                    menu_menuEdit_pname.Value = new MenuBll().GetModel(model.Pid).MenuName;
                menu_menuEdit_name.Value = model.MenuName;
                menu_menuEdit_rank.Value = model.HtmlRank.ToString();
                menu_menuEdit_url.Value = model.HtmlUrl;
                menu_menuEdit_ico.Value = model.HtmlFaicon;
                menu_menuEdit_tabid.Value = model.HtmlTabid.ToString();
            }
            else
            {
                string menuPID = Request.QueryString["pid"];
                if (!string.IsNullOrEmpty(menuPID))
                {
                    MenuModel model = new MenuBll().GetModel(Int32.Parse(menuPID));
                    menu_menuEdit_pid.Value = model.MenuID.ToString();
                    menu_menuEdit_tid.Value = model.MenuTypeID.ToString();
                    menu_menuEdit_tiddiv.Attributes.Add("style", "display:none");
                    menu_menuEdit_pname.Value = model.MenuName;
                }

            }
        }
    }
}